package ecmnext.net;


/***************************************************************/
/*                     SOFTWARE SECTION                        */
/***************************************************************/
/*
 * <p>Name: ECMNext</p>
 * <p>Description: Simulation of the platform of trading Software</p>
 * <p>Licence: General Public License</p>
 * <p>Organisation: EC Marseille</p>
 * <p>Persons involved in the project : groupE Plateforme de Trading</p>
 * <p>Current version: 1.0</p>
 */


/***************************************************************/
/*                       IMPORT SECTION                        */
/***************************************************************/

import org.jdom.*;

/***************************************************************/
/*                  Messages CLASS SECTION                     */
/***************************************************************/

/**
 * <p>Title : Message</p>
 * <p>Description : This class is used to exchange messages between the client
 * and the server. The content of the message is about sure information on the experiment
 * just as dividend, connection messages etc.</p>
 * @author Xuewen YANG ET Antoine COUDERC
 * @version 1.0
 */

public class Message implements NetworkWritable, NetworkReadable {


  private String message;

  public String getMessage() {
    return this.message;
  }

  public Message(String message) {
    this.message = message;
  }

  public boolean initFromNetworkInput(Element node) {
    if (!node.getName().equals("Message")) return false;

    this.message = node.getText();
    return true;
  }

  public Element prepareForNetworkOutput(String pt) {
    Element node = new Element("Message");
    return node.setText(this.message);
  }

}
